<?php
/*
//ini_set('memory_limit', '-1');
ini_set("memory_limit", "128M"); //ojo


include "../include/config.php";
include "../include/db.php";
//include("include/db.php");

$query = $_REQUEST['query'];
$result = mysql_query($query) or trigger_error(mysql_error());


$jsonArr = array();
$arrTodo = array();

//try {
//    $result = mysql_query($query);
//} catch (Exception $e) {
//
//    $jsonArr['errorMsj'] = $e->getMessage();
//    $jsonArr['status'] = "error";
//    
//    echo json_encode($jsonArr);
//    die();
//}

if (stristr($query, 'select')) {
//if (mysql_num_rows($result) > 0) {

    while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {//solo las claves
        $row = array_map("utf8_encode", $row);        
        $arrTodo[] = $row;
    }
    
//    while ($row = mysql_fetch_object($result)) {
//        //$row = array_map("utf8_encode", $row);        
//        $arrTodo[] = $row;
//    }

    $jsonArr['total'] = mysql_num_rows($result);
    $jsonArr['objetos'] = $arrTodo;
} else {
    $jsonArr['msj'] = "ejecutado con exito";
}

$jsonArr['status'] = "ok";
*/

//$b = array("uno", "dos", "tres", "cuatro", "cinco");
//$b = array_map("utf8_encode", $b);

//$jsonArr = array_map("utf8_encode", $jsonArr);

//echo json_encode($jsonArr);

//echo "holas";

print_r($_REQUEST);

?>